/*
 * @Descripttion: .
 * @Version: .
 * @Author: JM
 * @Date: 2023-03-01 15:40:01
 * @LastEditors: .
 * @LastEditTime: 2023-03-01 15:47:18
 */
import { createSlice } from "@reduxjs/toolkit";

// 1 创建切片
const commonSlice = createSlice({
  name: "category",
  // 2 定义状态
  initialState: {
    tabbar: true, // 决定是否显示底部按钮
  },
  // 3 定义修改状态的方法
  reducers: {
    showTabbar: (state) => {
      state.tabbar = true;
      console.log(state.tabbar);
    },
    hideTabbar: (state) => {
      state.tabbar = false;
      console.log(state.tabbar);
    },
  },
});

// 4 解构actions
export const { showTabbar, hideTabbar } = commonSlice.actions;

// 5 如果是异步请求 在这里定义异步流程操作方法

export default commonSlice.reducer;
